Repository navigation
fix(lint): a context pack may name a system column the platform injects - #37426
objectstack-fleet[bot] wants to merge 4 commits into
Conversation
…ted system columns ai-context-field-unknown warned on owner_id / created_at in a pack on an object that does not declare them, while get_record_context reads the published definition, which carries the injected columns, and serves them. Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
… system columns Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9093ea008d3eb37ec04bb8509820c9666bff48b1 && git checkout 9093ea008d3eb37ec04bb8509820c9666bff48b1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ee11fce924ee0be609807738a3e0770cf6c396a3 83f809e905c3ad3d202495a7d304a23ad595662c && git checkout -B drift-repro ee11fce924ee0be609807738a3e0770cf6c396a3 && git merge --no-ff 83f809e905c3ad3d202495a7d304a23ad595662c
node scripts/docs-audit/affected-docs.mjs --json ee11fce924ee0be609807738a3e0770cf6c396a3 |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 83f809e · 2026-11-26T04:22Z The seat runs the at-tier contract review of this head through an isolated sub-agent; L1 is the seat's own. |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: PR #37426 (card #37415, parent #37177). Read: the card body and its four comments (claim 7181320357, scope note 7181733701, triage 7181895697, os-dev-report 7182515207), the parent body, the PR body, the four-file net diff against ① Derived judgmentsThe diff publishes no schema, no export and no signature change. What it changes is the verdict set of one advisory lint rule,
S2 (should-fix) — File a follow-up card for the provenance warning on external objects, and name its number in the PR's acceptance notes. "Noted, not filed" is not enough here: the PR itself removes the only author-surface signal for a pack whose N1 (nit) — The changeset and the N2 (nit) — The ② Semver level
S1 (should-fix) — The ③ Boundary flagsDev flags (
N3 (nit) — Fold
Out-of-scope findings in the report:
SQL push-down (AGENTS.md, Prime Directive 5): no finding. The lint change is a pure in-memory merge over metadata. The service change is a test over the fake door. The diff adds no query, no id materialisation and no in-app join. Gate verdicts on the head: every check-run is Findings: S1 and S2 are open should-fix items, both closable without moving the head. N1, N2 and N3 are nits. No must-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Delta re-read of record 7182623911, on the same head. The head did not move: the PR still reads ① Derived judgmentsNo change to any judgment. One finding moves: S2: closed. Card #37432 is open, N1 (nit) — Still open, prose only: the changeset names only the three references to N2 (nit) — Still open and without a carrier: #37432 folds the test file but does not ask for the ② Semver levelS1: closed. The PR body's line now reads Gate state after the body edit: ③ Boundary flagsNo change to any answer. Two carriers are now on a card:
SQL push-down: unchanged, no finding. The diff is the same. Findings: no must-fix and no should-fix remain open. N1 and N2 are open nits. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc Landing: ACCEPT 7182715779 (delta L2 PASS 7182700579) at head
Status: ready + auto-merge (merge queue). On MERGED, #37415 closes by |
Fixes #37415
Clause-②: no (ADR-0160 D3: "A name the published definition lacks is an author defect"; an injected column is in the published definition, so the warning on it was the defect)
Metadata-protocol: none
维护者速读
What changes
Measured first, on one real kernel (the
/mcpdoor, the real protocol,SqlDriver,sys_userregistered as the platform registers it): on an object that declares neitherowner_idnorcreated_at, the served object listing carries both (plusorganization_id,created_by,updated_at,updated_by,owning_business_unit_id,queue), andget_record_contextanswersowner_idandcreated_atin the root'sfieldsand in a related list'sfields(owner_idas a lookup entry, its value markednotVisiblebecause the harness caller cannot open thesys_userrow, as for any lookup whose target row it cannot read), filters the list by awhereonowner_id(one of two rows came back, the caller's) and orders it bycreated_at. On anownership: 'org'object the listing carries noowner_idand the tool leaves it out. So the runtime carries injected columns, and the warning was false.packages/lint/src/validate-ai-context.ts:fieldMapOfnow returns the effective map, the declared fields plusinjectedColumnDefsFor(object)(this package's one indirection over the spec'sinjectedSystemColumnDefs, the tablesapplySystemFieldsand the served read'sapplyInjectedSystemColumnsspread), a declared field winning. Every place the rule reads a field map reads it: rootfields,body.field, relatedfields,where,orderBy, and the related link. TheorderBysortability projection now reads the same effective map instead of the declared fields.body.fieldnaming an injected column is judged by its type (ai-context-body-not-long-text, as the executor reads the served definition); on a related list whose root is asys_*object, the child's injected references to it (owner_id,created_by,updated_bytosys_user) count as links, asresolveRelatedLinkcounts them over the published definition, so a child with one declared reference and nofieldis reported as having several. No non-sys_*root is affected: every injected reference points at asys_*object.owner_idunderownership: 'org'/'none', every system column undersystemFields: false..changeset/37415-ai-context-injected-columns.md:@objectstack/lintpatch.Read first (by risk)
packages/lint/src/validate-ai-context.ts, thefieldMapOfhunk: the merge direction (declared wins) and the sortability line.packages/lint/src/validate-ai-context.test.ts, the four new cases, especially thesys_*root link case.packages/services/service-record-context/src/__tests__/injected-system-columns.test.ts: the executor half over a door serving the registry-injected shape.Two-minute verification
pnpm --filter @objectstack/lint exec vitest run src/validate-ai-context.test.tsshows 22 passed, including "an injected system column the object does not declare is no unknown field (owner_id, created_at)".Tests
packages/lint/src/validate-ai-context.test.ts:owner_id,created_at,created_byin rootfields, relatedfields,where,orderByon objects that do not declare them: no finding.ownership: 'org'keepsowner_idunknown in all four places;systemFields: falsekeepscreated_atunknown.body.field: 'created_at'isai-context-body-not-long-text.sys_*root: injected references count as links.packages/services/service-record-context/src/__tests__/injected-system-columns.test.ts(new, read-only use of the service): over the fake door servinginjectedSystemColumnDefsmerged under the declared fields, the executor answersowner_id(with thesys_userdisplay) andcreated_atin root and related fields, filters bywhere: { owner_id }and orders bycreated_at desc; the same pack over a door serving declared fields only leaves every such name and the list out, silently.Acceptance notes
owner_idon an object that does not declare it, matching the measured runtime answer): the first new lint case; the measured runtime answer is quoted in a comment above it and in the service test's header.created_aton an object that does not declare it, while the rule warnedai-context-field-unknown: the same runtime answer forcreated_atinorderBy, measured independently.owner_idwas measured here.packages/runtime/src/mcp-record-context-tools-bridge.test.ts, run once and deleted, never committed (packages/runtime/**is fenced for this card). The committed pin of the executor half is the new service test over the fake door.sys_userregistered (a composition the platform never ships), namingowner_idrefuses the whole callPERMISSION_DENIED("reads an object you cannot read"):owner_idis a lookup tosys_user, and an unreadable lookup target refuses the call, as for any lookup. Measured, noted, not filed.os explaintext forai-context-field-unknown(packages/lint/src/rule-explanations.ts) still says "a name the object does not define"; it is outside this card's file surface and stays correct in substance (an injected column is defined on the object). Noted, not changed.externalobject carries injected columns with no storage behind them; this rule now lets a pack name one (the published definition carries it, so the executor plans it), and the read degrades at query time. The provenance warning other rules give (unprovisionedInjectedColumnsFor) is not wired into this rule. Filed as 37415 跟进:资料包校验对外部对象的注入字段给出「无存储」提醒,并合并测试文件 #37432 (an own rule id and anos explainentry), which also carries foldinginjected-system-columns.test.tsintorecord-context-tools.test.tsonce 37203 跟进:get_record_context 无权的关联子对象改为省略、真实通道交出可查询字段,并补筛选排序的双通道比对 #37361 lands.Verification
Real-kernel measurement (scratch, deleted)
Ablation (one, on the chosen behaviour)
Deleted the injected-column merge line in
fieldMapOfviascripts/ablation-replace.mjs(anchor x1 to x0, blob c2119a56ce9c to 2c8b47c54ad1);validate-ai-context.test.tswent 3 failed / 18 passed (the injected-column case, the ownership-org case throughcreated_at, the body case); restored, blob equals HEAD (c2119a56ce9c),git diff HEADempty. The lint test imports the rule from source, so no build leg applies.Package suites and gates
All at head
83f809e90, through the verify lock (VERDICT command-exit 0, 129 s held):Gates:
node scripts/pm/dispatch-gates.mjs --commandsderived 64 families for this diff; all 64 run locally, 62 exit 0, 2 exit 3 (PREREQUISITE NOT MET, read as NOT MEASURED, left to CI):node scripts/check-plugin-teardown-shape.mjs --self-test(its pinned positive control needs an unshallow clone) andpnpm check:dual-build-cjs-loads(reads every package'sdist/; only the runtime closure is built here).--ranreconciliation: 64 derived, 62 run, 2 NOT-MEASURED, 0 UNRUN. Package-closure build ahead of these:pnpm --workspace-concurrency=2 --filter '@objectstack/runtime^...' build(includes@objectstack/lintand@objectstack/service-record-context),VERDICT command-exit 0.Generated by Claude Code